<%--
 *  File:   DataLookedHead.jsp
 *  Date	2011/5/22	  
 *  Author		  Kevinfan
 *
 *  Copyright (C) 2000 - 2011 Oval Technologies, Inc.
 *  All rights reserved.
 *
 *  This software is the confidential and proprietary information of Oval
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>
<%@ page contentType="text/html;charset=UTF-8"%>
<%
  //init param
  String privilegeCode = "A0107";
  String strTableName = "v_zylhosppurchsalinv";
  String strModuleName = "TDR";
  String contextPath = request.getContextPath();
%>
<%@ include file="/inc/CommonHeader.inc" %>
<%@ include file="/inc/OvalLocationDefault.inc" %>

<html>
<head>
<PageFlow:CheckPageFlow pageName="p_purchaseverify"/>
<%
  Vector summary = (Vector)pageContext.getAttribute("totalsummary");
  HashMap userinfo = (HashMap)session.getAttribute("userinfo");
  Integer style1 = (Integer) pageContext.getAttribute("style");
  int endday1 = Integer.parseInt((String)pageContext.getAttribute("endday1"));
  int endday2 = Integer.parseInt((String)pageContext.getAttribute("endday1"));
  java.util.Calendar cal = java.util.Calendar.getInstance();      
  int day = cal.get(Calendar.DAY_OF_MONTH);
  String style = style1.toString();
  String  issalesman = (String) userinfo.get("issalesman");
  Integer  departmentid = (Integer) userinfo.get("deptid");
  String  username = (String) userinfo.get("empoyeename");
  String deptid = departmentid.toString();
  String flag = (String)pageContext.getAttribute("flag");
  if(summary == null)summary = new Vector();
  
%>
<%@ include file="/inc/CatchError.inc" %>
<%@ include file="/inc/SumDiv.inc" %>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="<%=contextPath%>/css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="<%=contextPath%>/css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/ScriptLib.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/SummaryDivision.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/keyFunction.js"></script>
<script language="JavaScript">
function page_action(thisobj,pname)
{	
  years = document.cform.years.value;
  months = document.cform.months.value;
  businesstype = document.cform.businesstype.value;
  statusstr = document.cform.status.value;
  regionid = document.cform.regionid.value;
  businessarealist = document.cform.businessarealist.value;
  proviceofficelist = document.cform.proviceofficelist.value;
  userids = document.cform.userids.value;
  switchTags(thisobj);
  parent.down.location.href= pname+"&years="+years+"&months="+months+"&status=" +statusstr+"&regionid="+regionid+"&businessarealist="+businessarealist+"&proviceofficelist="+proviceofficelist+"&userids="+userids;
}

//salesman
function popRep() {
	var regionid=cform.regionid.value;
	var proviceofficecode = document.cform.proviceofficelist.value;
	var businessareacode = document.cform.businessarealist.value;
	var status = "height=400, width=600, top=100, left=100, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no";
	var url = "SalesPopWindow.jsp?<%= OvalTools.randomURL() %>&regionid="+regionid+"&proviceofficecode="+proviceofficecode+"&businessareacode="+businessareacode;
	popwindow = window.open(url, "newwindow", status);
  }

function SetSalesMan(id,code,name){
	cform.userids.value=id;
	cform.employeecode.value=code;
	cform.employeename.value=name;
}

//getbusinessarea
function page_getpriviceoffice(){
	var objdeptcode=eval("cform.regionid");
	var style = document.cform.style.value;
	if (objdeptcode==""){
	    return;
	}
	var  datahandler = new  DataHandler();
	datahandler.add_params("style" , style, 'Integer');
	datahandler.add_params("regionid" , objdeptcode.value , "Integer");
	datahandler.getResultFromVector("resultproviceoffice","proviceofficename","proviceofficecode","document.cform.proviceofficelist");
	datahandler.add_job("j_purchaseverify");
	datahandler.runDataHandler();
  }

function page_getbusinessarea(){
	var regionid = document.cform.regionid.value;
	var style = document.cform.style.value;
	var objdeptcode=eval("cform.proviceofficelist");
	if (objdeptcode==""){
	    return;
	}
	var  datahandler = new  DataHandler();
	datahandler.add_params("style" , style, 'Integer');
	datahandler.add_params("regionid" , regionid, "Integer");
	datahandler.add_params("proviceofficelist" , objdeptcode.value , "String");
	datahandler.getResultFromVector("resultbusinessarea","businessareaname","businessareacode","document.cform.businessarealist");
	datahandler.add_job("j_purchaseverify");
	datahandler.runDataHandler();
 }


</script>
</head>
<body>
<iframe id="reloadHandler" name="reloadHandler" style="display:none"></iframe>
<form name="cform" method="post" action="<%=contextPath%>/Dispatcher">
    <input type="hidden" name="pagename" value="p_purchaseverify">
    <input type="hidden" name="actionname">
    <custom:hidden property="style"/>
    <custom:hidden property="changestatus"/>
    <custom:hidden property="businesstype"/>
    <custom:hidden property="orgid"/>
	<custom:hidden property="partnerid"/>
	<custom:hidden property="prodid"/>
<custom:hidden property="year"></custom:hidden>
<custom:hidden property="month"></custom:hidden>
    <table width="100%" cellspacing="0" border="0" cellpadding="0">
      <tr>
        <td>
          <table  width="500" border="0" cellspacing="0" >
        	<tr>
        		<%       
					String year = cal.get(Calendar.YEAR)+"";     
					String month = cal.get(Calendar.MONTH)+"";
					if(cal.get(Calendar.MONTH) == 0){
						month = "12";
						year = (cal.get(Calendar.YEAR)-1)+"";
					}  
					if("first".equals(flag)){ 
				%>
	        	<td style="width:40px;" class="td_right" ><%=label.getLabelName("L_Year1")  +  label.getLabelName("L_Colon") %></td>
	        	<td style="width:50px;" class="td_left"><custom:selectdic property="years" dictType="Years" command="notnull" value="<%=year %>" label="L_Year1"/></td>
	        	<td style="width:40px;" class="td_right"><%=label.getLabelName("L_Month") +  label.getLabelName("L_Colon") %></td>
	        	<td style="width:50px;" class="td_left"><custom:selectdic property="months" dictType="Months" command="notnull" value="<%=month %>" label="L_Month"/></td>
	        	<%}else{ %>
	        	<td style="width:40px;" class="td_right"><%=label.getLabelName("L_Year1") +  label.getLabelName("L_Colon") %></td>
	        	<td style="width:50px;" class="td_left"><custom:selectdic property="years" dictType="Years" command="notnull" label="L_Year1"/></td>
	        	<td style="width:40px;" class="td_right"><%=label.getLabelName("L_Month") +  label.getLabelName("L_Colon") %></td>
	        	<td style="width:50px;" class="td_left"><custom:selectdic property="months" dictType="Months" command="notnull" label="L_Month"/></td>
	        	    <%
	        	    }
					if("1".equals(style)){
					%>
					<td style="width:40px;" class="td_right"><%=label.getLabelName("L_Status") +  label.getLabelName("L_Colon") %></td>
	        	  <td style="width:50px;" class="td_left"><custom:selectdic property="status" dictType="ZylStatus" valueCriteria="40,28,41" defaultValue="-------" defaultValueCost="" command="notnull" label="Status"/></td>
					<% }
					else {
						if("Y".equals(issalesman)){
			        %>
	        	<td style="width:40px;" class="td_right"><%=label.getLabelName("L_Status") +  label.getLabelName("L_Colon") %></td>
	        	<td style="width:50px;" class="td_left"><custom:selectdic property="status" dictType="ZylStatus" valueCriteria="41,28" defaultValue="-------"  defaultValueCost="" command="notnull" label="Status"/></td>
        	    <%}else{ %>
        	    <td style="width:40px;" class="td_right"><%=label.getLabelName("L_Status") +  label.getLabelName("L_Colon") %></td>
	        	<td style="width:50px;" class="td_left"><custom:selectdic property="status" dictType="ZylStatus" valueCriteria="40,28,41" defaultValue="-------" defaultValueCost="" command="notnull" label="Status"/></td>
				<%} }%> 
        	    </tr>
				</tr>
				</table>
				</td></tr>
				<tr>
				<td>
				<table width="1000" border="0" cellspacing="0" >
        	      <%
	                if("Y".equals(issalesman)){
	                %> 
	                <tr>
	                <td style="width:40px;">&nbsp;</td><td style="width:150px;">&nbsp;</td>
	               <td style="width:40px;">&nbsp;</td><td style="width:150px;">&nbsp;</td>
	               <td style="width:40px;">&nbsp;</td><td style="width:150px;">&nbsp;</td>
	               <td style="width:60px;">&nbsp;</td><td style="width:150px;">&nbsp;</td>
	               <td style="width:60px;">&nbsp;</td><td style="width:150px;">&nbsp;</td>
	               </tr>
	                <%}else{ %>
        	    <tr>
        	   <td style="width:40px;" class="td_right"><%=label.getLabelName("L_Businessarea") +  label.getLabelName("L_Colon") %></td>
        	  	<td style="width:150px;" class="td_left">
        	  	<custom:select property="regionid" optionInnerTextKey="regionname" optionsName="resultregion" optionValueKey="regionid" style="width:150px;" onchange="page_getpriviceoffice()" defaultValue="ALL" defaultValueCost=""/></td>
        	    <td style="width:40px;" class="td_right"><%=label.getLabelName("L_ProvinceOffice") +  label.getLabelName("L_Colon") %></td>
				<td style="width:150px;" class="td_left">
				
				<custom:select property="proviceofficelist" optionInnerTextKey="proviceofficename" optionsName="resultproviceoffice" optionValueKey="proviceofficecode" style="width:150px;" defaultValue="----------" defaultValueCost="" onchange="page_getbusinessarea();"/></td>
				
			   <td style="width:60px;" class="td_right"><%=label.getLabelName("L_BusinessAreaName") +  label.getLabelName("L_Colon") %></td>
				<td style="width:150px;" class="td_left">
				<custom:select property="businessarealist" optionInnerTextKey="businessareaname" optionsName="resultbusinessarea" optionValueKey="businessareacode" style="width:150px;" defaultValue="----------" defaultValueCost=""/> </td>
				
        	   <td style="width:60px;" class="td_right"><%=label.getLabelName("L_BusinessContact") +  label.getLabelName("L_Colon") %></td>
				<td style="width:150px;">
			<custom:text property="employeename" size="20" readonly="true" style="border:1px #7F9DB9 solid;"/>
			<a onClick="javascript:popRep();"><custom:button type="3" label="L_Asterisk" imgsrc="flash.gif" border="0"/></a> 
			<custom:hidden property="userids"/>
			<custom:hidden property="employeecode"/>
		   </td>
				<td style="20px;"><button type="reset" class="button1" name="re" value="clear"  style="width:60"><%=label.getLabelName("L_Clear") %></button></td>
			<%} %>
        	</tr>
          </table>
        </td>
      </tr>
      <tr>
         <td style="PADDING-BOTTOM: 0px; PADDING-LEFT: 1px; PADDING-RIGHT: 1px; PADDING-TOP: 0px">
             <table border="2" cellpadding="0" height="30px" cellspacing="0">
             <tbody>
                <tr>
					<td class="hand1" valign="bottom" style="border-right:none;border-left:none;" width="120" background="<%=contextPath %>/images/cn/manv_1_bg.png" onclick="javascript:page_action(this,'<%=contextPath%>/tdr/dataverify/Level2DealPurchase.jsp?<%= OvalTools.randomURL() %>&businesstype=100');"><div align="center"><%= label.getLabelName("L_OneLevelDealp")%></div></td>
					<td class="hand1" valign="bottom" style="border-right:none;border-left:none;" width="120" background="<%=contextPath %>/images/cn/manv_1_bg.png" onclick="javascript:page_action(this,'<%=contextPath%>/tdr/dataverify/PuYaoLevel2DealPurchasse.jsp?<%= OvalTools.randomURL() %>&businesstype=190');"><div align="center"><%= label.getLabelName("L_TwoLevelDealpc")%></div></td>
					<td class="hand1" valign="bottom" style="border-right:none;border-left:none;" width="120" background="<%=contextPath %>/images/cn/manv_1_bg.png" onclick="javascript:page_action(this,'<%=contextPath%>/tdr/dataverify/HospitalPurchasse.jsp?<%= OvalTools.randomURL() %>&businesstype=160');"><div align="center"><%= label.getLabelName("L_HospitalBuy")%></div></td>
					<td class="hand1" valign="bottom" style="border-left:none;" width="120" background="<%=contextPath %>/images/cn/manv_1_bg.png" onclick="javascript:page_action(this,'<%=contextPath%>/tdr/dataverify/PharmacyPurchasse.jsp?<%= OvalTools.randomURL() %>&businesstype=140');"><div align="center"><%= label.getLabelName("L_PharmacyBuy")%></div></td>
				</tr>
                </tbody>
                </table>
           </td>
        </tr>
 </table>
 </form>
 </body>
 </html>